package com.bsj.power.tool.controller;

import com.bsj.power.common.config.global.JsonResult;
import com.bsj.power.tool.config.websocket.TestWebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yinhao
 * @version 1.0
 * @description 测试接口
 * @date 2024/10/24
 */
@Slf4j
@RestController
@RequestMapping("/api")
public class MainApi {

    @Autowired
    private TestWebSocketServer testWebSocketServer;

    @RequestMapping(value = "/send")
    public JsonResult senWebsocket(String data) {
        testWebSocketServer.sendData(data);
        return JsonResult.success();
    }
}
